using System.Collections;
using System.Collections.Generic;
using UnityEngine;

//定义状态机的状态
public enum StateType
{
    Idle,//待机
    Move,//移动
    Find_Enemy,//寻找敌人
    Attack,//攻击
    Die,//死亡
    Success,//胜利
}

//定义AI的类
public class Ai : MonoBehaviour
{
    private StateType curState;
    
    void Start()
    {
        curState = StateType.Idle;
    }
    
    void Update()
    {
        switch (curState)
        {
            case StateType.Idle:
                OnIdle();
                break;
            case StateType.Move:
                OnMove();
                break;
            case StateType.Find_Enemy:
                OnFindEnemy();
                break;
            case StateType.Attack:
                OnAttack();
                break;
            case StateType.Die:
                OnDie();
                break;
            case StateType.Success:
                OnSuccess();
                break;
            default:
                break;
        }
    }

    private void OnSuccess()
    {
        
    }

    private void OnDie()
    {
        
    }

    private void OnAttack()
    {
        
    }

    private void OnFindEnemy()
    {
        
    }

    private void OnMove()
    {
        
    }

    private void OnIdle()
    {
        //判断只执行一次状态切换
        if (curState == StateType.Idle)
        {
            return;
        }
        
        Debug.Log("待机状态");   
    }
}
